package com.dennisstepp.activities;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;

import com.dennisstepp.R;
import com.dennisstepp.database.BosculDbAdapter;

public class SmallBosculActivity extends ListActivity {
	private static BosculDbAdapter db;
	private static Cursor c;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		String[] from = new String[] { BosculDbAdapter.KEY_NAME,
				BosculDbAdapter.KEY_VALUE, BosculDbAdapter.KEY_STATUS };

		int[] to = new int[] { R.id.nameText, R.id.valueText, R.id.statusText };

		db = new BosculDbAdapter(this);
		db.open();

		c = db.fetchAllSmallBoscul();

		SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
				R.layout.boscullayout, c, from, to);
		setListAdapter(adapter);
	}

	@Override
	protected void onPause() {
		c.close();
		db.close();
		super.onPause();
	}

}
